<template>
  <div>
    <child-component :messageValue="parentMessage" @message-sent="handleMessage"></child-component>
  </div>
</template>

<script>
import ChildComponent from './ChildComponent.vue'
export default {
   inject: ['message'],
  data(){
    return{
      parentMessage: 'props 父传子'
    }
  },
  components:{ChildComponent},
  methods: {
    handleMessage(data) {
      console.log(data); // 在控制台打印出从子组件传递过来的数据
    }
  }
}
</script>
